
class UserAccountController{
   String username = "Craig"

   @Autowired
   UserRepository userRepository

   @RequestMapping(method = RequestMethod.GET)
   def userList(Model model)
   {
       List<User> userList = userRepository.findByUserName(String username)
       if(userList)
       {
           model.addAttribute("Users",userList)
       }
       "readinglist"
   }

   @RequestMapping(method=RequestMethod.POST)
   def addToUserList(User user)
   {
       user.setUsername(username)
       userRepository.save(user)
       "redirect:/"
   }
}
